package com.lfm.jdbc.datasource;

import com.lfm.jdbc.utils.JDBCUtils;
import org.junit.jupiter.api.Test;

import java.sql.Connection;

public class ConQuestion {
    //代码连接 mysql 5000 次
    @Test
    public void testCon() {
        System.out.println("开始");
        long start = System.currentTimeMillis();
        for (int i = 0; i < 5000; i ++) {
            Connection connection = JDBCUtils.getConnection();
            //做一些工作， 比如得到PreparedStatement, 发送sql
            //.....
            JDBCUtils.close(null, null, connection);
        }

        long end = System.currentTimeMillis();
        System.out.println("传统方式耗时" + (end - start));
    }

}
